function C57_CPP_combined_PV_Bar_Graph(Data_Summary)
% This function plots PV bar graphs for all conditions in the dataset to
% visually compare them

%% Step 1: Collect all Data

% C57_5
[C5_saline, C5_saline_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_5', 'saline');
[C5_cpp1, C5_cpp1_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_5', '(R)_CPP 1mg/kg');
[C5_cpp3, C5_cpp3_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_5', '(R)_CPP 3mg/kg');
[C5_cpp10, C5_cpp10_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_5', '(R)_CPP 10mg/kg');
[C5_AB, C5_AB_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_5', 'altered contexts');
[C5_recall_cpp10, C5_recall_cpp10_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_5', 'pre_recall_(R)_CPP 10mg/kg');
[C5_72h, C5_72h_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_5', '>24h same context');

% C57_6
[C6_saline, C6_saline_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_6', 'saline');
[C6_cpp1, C6_cpp1_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_6', '(R)_CPP 1mg/kg');
[C6_cpp3, C6_cpp3_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_6', '(R)_CPP 3mg/kg');
[C6_cpp10, C6_cpp10_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_6', '(R)_CPP 10mg/kg');
[C6_AB, C6_AB_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_6', 'altered contexts');
[C6_recall_cpp10, C6_recall_cpp10_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_6', 'pre_recall_(R)_CPP 10mg/kg');
[C6_72h, C6_72h_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_6', '>24h same context');

% C57_7
[C7_saline, C7_saline_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_7', 'saline');
[C7_cpp1, C7_cpp1_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_7', '(R)_CPP 1mg/kg');
[C7_cpp3, C7_cpp3_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_7', '(R)_CPP 3mg/kg');
[C7_cpp10, C7_cpp10_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_7', '(R)_CPP 10mg/kg');
[C7_AB, C7_AB_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_7', 'altered contexts');
[C7_recall_cpp10, C7_recall_cpp10_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_7', 'pre_recall_(R)_CPP 10mg/kg');
[C7_72h, C7_72h_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_7', '>24h same context');

% C57_8
[C8_saline, C8_saline_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_8', 'saline');
[C8_cpp1, C8_cpp1_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_8', '(R)_CPP 1mg/kg');
[C8_cpp3, C8_cpp3_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_8', '(R)_CPP 3mg/kg');
[C8_cpp10, C8_cpp10_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_8', '(R)_CPP 10mg/kg');
[C8_AB, C8_AB_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_8', 'altered contexts');
[C8_recall_cpp10, C8_recall_cpp10_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_8', 'pre_recall_(R)_CPP 10mg/kg');
[C8_72h, C8_72h_M] = PV_One_Animal_One_Dose(Data_Summary, 'C57_8', '>24h same context');

%% Step2: Organize & Summarize data

% get mean for each genotype under each condition
saline_M = mean(cat(1, C5_saline_M, C6_saline_M, C7_saline_M, C8_saline_M));
cpp1_M = mean(cat(1, C5_cpp1_M, C6_cpp1_M, C7_cpp1_M, C8_cpp1_M));
cpp3_M = mean(cat(1, C5_cpp3_M, C6_cpp3_M, C7_cpp3_M, C8_cpp3_M));
cpp10_M = mean(cat(1, C5_cpp10_M, C6_cpp10_M, C7_cpp10_M, C8_cpp10_M));
AB_M = mean(cat(1, C5_AB_M, C6_AB_M, C7_AB_M, C8_AB_M));
recall_cpp10_M = mean(cat(1, C5_recall_cpp10_M, C6_recall_cpp10_M, C7_recall_cpp10_M, C8_recall_cpp10_M));
same_72h_M = mean(cat(1, C5_72h_M, C6_72h_M, C7_72h_M, C8_72h_M));


% get standard error for each genotype under each condition (from the mean of each animal, not individual experiment)
saline_SE = calculate_standard_error(cat(1, C6_saline_M, C8_saline_M, C7_saline_M, C8_saline_M));
cpp1_SE = calculate_standard_error(cat(1, C6_cpp1_M, C8_cpp1_M, C7_cpp1_M, C8_cpp1_M));
cpp3_SE = calculate_standard_error(cat(1, C6_cpp3_M, C8_cpp3_M, C7_cpp3_M, C8_cpp3_M));
cpp10_SE = calculate_standard_error(cat(1, C6_cpp10_M, C8_cpp10_M, C7_cpp10_M, C8_cpp10_M));
AB_SE = calculate_standard_error(cat(1, C5_AB_M, C6_AB_M, C7_AB_M, C8_AB_M));
recall_cpp10_SE = calculate_standard_error(cat(1, C5_recall_cpp10_M, C6_recall_cpp10_M, C7_recall_cpp10_M, C8_recall_cpp10_M));
same_72h_SE = calculate_standard_error(cat(1, C5_72h_M, C6_72h_M, C7_72h_M, C8_72h_M));


%% Step 3: Plot Data

figure
% plot for WT
A = categorical({'saline'});
B = categorical({'1mg/kg (R)-CPP'});
C = categorical({'3mg/kg (R)-CPP'});
D = categorical({'10mg/kg (R)-CPP'});
E = categorical({'Pre-recall 10mg/kg (R)-CPP'});
F = categorical({'>24h same context'});
G = categorical({'24h different contexts'});
X = cat(2,A,B,C,D,E,F,G);
X = reordercats(X,{'saline','1mg/kg (R)-CPP','3mg/kg (R)-CPP','10mg/kg (R)-CPP','Pre-recall 10mg/kg (R)-CPP','>24h same context','24h different contexts'});
Y = cat(2, saline_M, cpp1_M, cpp3_M, cpp10_M, recall_cpp10_M, same_72h_M, AB_M);
bar(X(1,1),Y(1,1),0.2,'LineWidth',1.2,'FaceColor','#2AF598');
ylabel('mean(PVcorr)');
xlabel('Experimental Condition');
hold on
bar(X(1,2),Y(1,2),0.2,'LineWidth',1.2,'FaceColor','#1BD7BB');
hold on
bar(X(1,3),Y(1,3),0.2,'LineWidth',1.2,'FaceColor','#08B3E5');
hold on
bar(X(1,4),Y(1,4),0.2,'LineWidth',1.2,'FaceColor','#003193');
hold on
bar(X(1,5),Y(1,5),0.2,'LineWidth',1.2,'FaceColor','#3f00ff');
hold on
bar(X(1,6),Y(1,6),0.2,'LineWidth',1.2,'FaceColor','#32CD32');
hold on
bar(X(1,7),Y(1,7),0.2,'LineWidth',1.2,'FaceColor','#ff7518');
hold on
err(1,1)=saline_SE;
err(1,2)=cpp1_SE;
err(1,3)=cpp3_SE;
err(1,4)=cpp10_SE;
err(1,5)=recall_cpp10_SE;
err(1,6)=same_72h_SE;
err(1,7)=AB_SE;
er = errorbar(X,Y,[],err,'LineWidth',2);    
er.Color = [0 0 0];                            
er.LineStyle = 'None'; 
ylim([0,0.6]);
set(gca,'FontSize',20);
hold on

% scatter plots with horizontal offsets - quick & dirty
half_num_animals_in_plot = 2;
initial_offset = -0.2;
offset = initial_offset;

sh = scatter(repmat(A,size(C5_saline,1),1),C5_saline(:,1),80,'^','r','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(C6_saline,1),1),C6_saline(:,1),80,'>','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(C7_saline,1),1),C7_saline(:,1),80,'<','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(C8_saline,1),1),C8_saline(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.2;
offset = initial_offset;

sh = scatter(repmat(B,size(C5_cpp1,1),1),C5_cpp1(:,1),80,'^','r','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(C6_cpp1,1),1),C6_cpp1(:,1),80,'>','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(C7_cpp1,1),1),C7_cpp1(:,1),80,'<','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(C8_cpp1,1),1),C8_cpp1(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.2;
offset = initial_offset;

sh = scatter(repmat(C,size(C5_cpp3,1),1),C5_cpp3(:,1),80,'^','r','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(C6_cpp3,1),1),C6_cpp3(:,1),80,'>','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(C7_cpp3,1),1),C7_cpp3(:,1),80,'<','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(C8_cpp3,1),1),C8_cpp3(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.2;
offset = initial_offset;

sh = scatter(repmat(D,size(C5_cpp10,1),1),C5_cpp10(:,1),80,'^','r','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(C6_cpp10,1),1),C6_cpp10(:,1),80,'>','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(C7_cpp10,1),1),C7_cpp10(:,1),80,'<','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(C8_cpp10,1),1),C8_cpp10(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.2;
offset = initial_offset;

sh = scatter(repmat(E,size(C5_recall_cpp10,1),1),C5_recall_cpp10(:,1),80,'^','r','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(E,size(C6_recall_cpp10,1),1),C6_recall_cpp10(:,1),80,'>','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(E,size(C7_recall_cpp10,1),1),C7_recall_cpp10(:,1),80,'<','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(E,size(C8_recall_cpp10,1),1),C8_recall_cpp10(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.2;
offset = initial_offset;

sh = scatter(repmat(F,size(C5_72h,1),1),C5_72h(:,1),80,'^','r','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(F,size(C6_72h,1),1),C6_72h(:,1),80,'>','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(F,size(C7_72h,1),1),C7_72h(:,1),80,'<','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(F,size(C8_72h,1),1),C8_72h(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 2;
initial_offset = -0.2;
offset = initial_offset;

sh = scatter(repmat(G,size(C5_AB,1),1),C5_AB(:,1),80,'^','r','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(G,size(C6_AB,1),1),C6_AB(:,1),80,'>','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(G,size(C7_AB,1),1),C7_AB(:,1),80,'<','r','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(G,size(C8_AB,1),1),C8_AB(:,1),80,'o','r','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


end